package org.example.service.impl;

import org.example.service.Test01;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.*;
import org.springframework.beans.factory.config.BeanPostProcessor;

public class Test01Impl implements Test01 , BeanFactoryAware, BeanNameAware, InitializingBean{

    private String userName;
    private String password;

    public Test01Impl() {
        System.out.println("执行构造器方法");
    }


    public void setUserName(String userName) {
        System.out.println("注入属性userName");
        this.userName = userName;
    }


    public void setPassword(String password) {
        System.out.println("注入属性password");
        this.password = password;
    }

    @Override
    public void printName() {
        System.out.println("正在实现接口的printName方法......");
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {

    }

    @Override
    public void setBeanName(String name) {
        System.out.println("执行setBeanName");

    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("执行afterPropertiiesSet");
//        this.userName="dxh";
        System.out.println(this.userName);
    }

    public void myInit(){
        System.out.println("执行init-method方法");
    }
//    @Override
//    public void destroy() throws Exception {
//
//    }
}